<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

$site = $this->site;

JHTML::stylesheet('site.css', 'media/com_syncr/');
JHTML::script('colorpicker.js', 'media/com_syncr/');
JHTML::script('site.js', 'media/com_syncr/');
?>
<script type="text/javascript">
	function submitbutton(pressbutton)
	{
		if (pressbutton == 'save' || pressbutton == 'apply')
		{
			if (document.adminForm.name.value == '') {
				alert("<?php echo JText::_('PLEASE_ENTER_A_NAME_FOR_THE_SITE'); ?>"); }
			else if (document.adminForm.apikey.value == '') {
				alert("<?php echo JText::_('PLEASE_ENTER_AN_API_KEY_FOR_THE_SITE'); ?>"); }
			else {
				submitform(pressbutton);
			}
		} else {
			submitform(pressbutton);
		}
	}
</script>

<form action="<?php echo JRoute::_('?option=com_syncr&controller=sites'); ?>" method="post" name="adminForm">
	<div class="width-60 col">
		<fieldset class="adminform">
			<legend><?php echo JText::_('SITE_DETAILS'); ?></legend>
			<table class="admintable">
				<!-- Site Name -->
				<tr>
					<td class="key">
						<?php echo JText::_('NAME'); ?>
					</td>
					<td>
						<input type="text" name="name" id="name" class="text_area" size="50" maxlength="36" value="<?php echo $site->name; ?>">
					</td>
				</tr>
				<!-- Site URL -->
				<tr>
					<td class="key">
						<?php echo JText::_('URL'); ?>
					</td>
					<td>
						<input type="text" name="url" id="url" class="text_area" size="50" maxlength="255" value="<?php echo $site->url; ?>">
					</td>
				</tr>
				<!-- Site Color -->
				<tr>
					<td class="key">
						<?php echo JText::_('Color'); ?>
					</td>
					<td>
						<input type="text" name="color" id="color" class="text_area" size="10" maxlength="7" value="<?php echo $site->color; ?>">
						<div id="cp">Color picker container</div>
					</td>
				</tr>
				<!-- Site Logo -->
				<tr>
					<td class="key">
						<?php echo JText::_('Favicon'); ?>
					</td>
					<td>
						<input type="text" name="logo" id="logo" class="text_area" size="50" maxlength="250" value="<?php echo $site->logo; ?>">
					</td>
				</tr>
				<!-- API -->
				<tr>
					<td class="key">
						<?php echo JText::_('API_KEY'); ?>
					</td>
					<td>
						<input type="text" name="apikey" id="apikey" class="text_area" size="40" maxlength="36" value="<?php echo $site->apikey; ?>">
					</td>
				</tr>
				<!-- Images -->
				<tr>
					<td class="key">
						<?php echo JText::_('COPY_IMAGES_AND_REPATH'); ?>
					</td>
					<td>
						<?php echo $this->image; ?>
					</td>
				</tr>
				<!-- Published -->
				<tr>
					<td class="key">
						<?php echo JText::_('PUBLISHED'); ?>
					</td>
					<td>
						<?php echo $this->published; ?>
					</td>
				</tr>
				
			</table>
		</fieldset>
	</div>
	<div class="width-40 col">
		<fieldset class="adminform">
			<legend><?php echo JText::_('DETAILS'); ?></legend>
			<p><strong><?php echo JText::_('NAME'); ?></strong>: <?php echo JText::_('SYNCR_NAME_DESCRIPTION'); ?></p>
			<p><strong><?php echo JText::_('COLOR'); ?></strong>: <?php echo JText::_('SYNCR_COLOR_DESCRIPTION'); ?></p>
			<p><strong><?php echo JText::_('LOGO'); ?></strong>: <?php echo JText::_('SYNCR_LOGO_DESCRIPTION'); ?></p>
			<p><strong><?php echo JText::_('API_KEY'); ?></strong>: <?php echo JText::_('SYNCR_API_KEY_DESCRIPTION'); ?></p>
			<p><strong><?php echo JText::_('COPY_IMAGES_AND_REPATH'); ?></strong>: <?php echo JText::_('SYNCR_COPY_IMAGES_AND_REPATH_DESCRIPTION'); ?></p> 
		</fieldset>
	</div>
	
	<input type="hidden" name="cid[]" value="<?php echo $site->id; ?>" />
	<input type="hidden" name="option" value="com_syncr" />
	<input type="hidden" name="task" value="" />
	
	<?php echo JHTML::_('form.token'); ?>
</form>